package com.jeesite.common.utils.excel.fieldtype;

import java.util.List;

import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import com.jeesite.common.utils.SpringUtils;
import com.jeesite.modules.sys.entity.Post;
import com.jeesite.modules.sys.service.PostService;

public class PostListType2 {

	public static String setValue(Object empCode) {
		if (StringUtils.isEmpty(empCode)) {
			return "";
		}
		Post post = new Post();
		post.setEmpCode(String.valueOf(empCode));
		PostService postService = SpringUtils.getBean(PostService.class);
		List<Post> posts = postService.findList(post);
		if(CollectionUtils.isEmpty(posts)) {
			return "";
		}
		StringBuffer sb = new StringBuffer();
		for (Post p : posts) {
			sb.append(p.getPostName());
			sb.append(",");
		}
		return sb.substring(0, sb.length() - 1);
	}
}
